<template>
  <div class="content">
    <el-tabs v-model="activeName">
      <el-tab-pane label="联拓支付" name="first">
        <el-form
          :inline="false"
          :model="form"
          class="demo-form-inline"
          ref="userListFrom"
          label-width="180px"
          label-position="left"
        >
          <el-form-item label="联拓key：" prop="lt_key">
            <el-input
              v-model="form.lt_key"
              placeholder="请输入联拓key："
            ></el-input>
          </el-form-item>
          <el-form-item label="联拓appId：" prop="lt_appId">
            <el-input
              v-model="form.lt_appId"
              placeholder="请输入联拓appId"
            ></el-input>
          </el-form-item>
          <el-form-item label="联拓merchantCode：" prop="lt_merchantCode">
            <el-input
              v-model="form.lt_merchantCode"
              placeholder="请输入联拓merchantCode"
            ></el-input>
          </el-form-item>
          <el-form-item label=" ">
            <el-button type="primary" @click="preservation" v-repeatClick
              >保存</el-button
            >
          </el-form-item>
        </el-form>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import { packApi } from "@/utils/public";
import { setting_info } from "@/api/global/globalSystem";
import { setting_company } from "@/api/currency";
export default {
  props: {
    content: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      activeName: "first",
      form: {
        // 联拓
        lt_key: "",
        lt_appId: "",
        lt_merchantCode: "",
      },
    };
  },
  created() {
    this.setting_info();
  },
  methods: {
    // 基本信息
    setting_info() {
      let query = packApi();
      setting_info(query).then((res) => {
        if (res.errcode == 0) {
          let { lt_key, lt_appId, lt_merchantCode } = res.data.info;
          this.form = {
            lt_key,
            lt_appId,
            lt_merchantCode,
          };
        }
      });
    },
    // 保存
    preservation() {
      let query = packApi(this.form);
      setting_company(query).then((res) => {
        if (res.errcode == 0) {
          this.$message({
            message: "保存成功",
            type: "success",
          });
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
  padding: 22px 42px;
  .title {
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
    line-height: 30px;
    display: flex;
    &-span {
      width: 30px;
      min-width: 30px;
    }
  }
}
/deep/.el-tabs__item.is-active {
  color: #009944;
}
/deep/.el-tabs__active-bar {
  color: #009944;
}
</style>